package com.bookmarket.test;

import com.bookmarket.entity.Custom;
import com.bookmarket.entity.Shop;
import com.bookmarket.service.LJShopCartService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;
import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:spring-mybatis.xml")
public class ShopDemo {


    @Resource
    private LJShopCartService ljShopCartService;


   /* @Test//测试根据name查询用户以及测试根据用户查询购物车
    public void test1(){
        Custom c=ljShopCartService.selectBy("张三");
        System.out.println(c.getId()+"***"+c.getName());
        List<Shop> list=ljShopCartService.selectByCustom(c);
        for (Shop s:list){
            System.out.println(s.getBook_price()+","+s.getBook_name());
        }
    }*/
   @Test
   public void test2(){
       System.out.println(ljShopCartService.selectById(44).getBook_name());
   }

    public LJShopCartService getLjShopCartService() {
        return ljShopCartService;
    }

    public void setLjShopCartService(LJShopCartService ljShopCartService) {
        this.ljShopCartService = ljShopCartService;
    }
}
